﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace WMM.Tapioca.Formula
{
    /// <summary>
    /// Preconditions provide a way of determining if a set of bound variables can activate 
    /// a formula value and output fact or an assertion value test or existence count.
    /// </summary>
    public class Precondition : FormulaResource
    {
        private string test;

        /// <returns> test of precondition. </returns>
        public string Test
        {
            get { return test; }
            set { test = value; }
        }

        /// <summary>
        /// Constructor.
        /// </summary>
        public Precondition(Linkbase.Resource resource)
            : base(resource)
        {
            foreach (XAttribute attr in resource.ResourceXElement.Attributes())
            {
                if (attr.Name.LocalName.Equals("test"))
                {
                    test = attr.Value;
                }                
            }
        }
    }
}
